
<?php
$CI = & get_instance();
$ur = $CI->uri->segment(4);
echo form_open_multipart('admin/news/create/'.$ur); ?>
<!-- start title -->
<div class="title corners_top" style="float: left; width: 600px;">
	<h6 style="color: #900;" id="forms">
		<?php echo "Thêm căn hộ"; ?>
		<span style="color: #F00"> <?php echo $namecat ?>
		</span>
	</h6>
</div>
<!-- end title -->
<div class="proccess_bar">
	<ul class="menu_bar">
		<li><?php $data = array('name' => 'create', 'value' => ' ','class'=>'delete-1', 'id' => 'save');
		echo form_submit($data);?> <!--<a href="#" ><span class="save-1"> </span>Save</a> -->
			Lưu</li>
		<li><?php
		$data = array('name' => 'close', 'value' => ' ','class'=>'delete-1', 'id' => 'cancel');
		echo form_submit($data);
		?>Hủy<!--<a href="#" ><span class="cancel-1"></span>Cancel</a>-->
		</li>
	</ul>
</div>
<div class="content">
	<div class="form">
		<?php
		if(isset($missing) && is_array($missing) )
		{
			echo ' <div><a href="javascript:();" title="Succes box" class="box error corners"><span class="close">&nbsp;</span>';
			foreach($missing as $item)
			{
				echo $item."<br />";
			}
			echo "</a></div>";
		}
		$code = "img";
		$label =$this->lang->line('image');
		?>

		<p>


		<h6 class="t_float" style="clear: left">
			<?php echo 	$label = "Chọn hình"/*$this->lang->line('image'); */?>
		</h6>
		<div class="images">
			<input type="text" id="fileName"
				class="file_input_textbox corners_left" readonly="readonly" />
			<div class="file_input_div">
				<input type="button" value="" class="file_input_button" /> <input
					type="file" name="img" id="img" class="file_input_hidden"
					onchange="javascript: document.getElementById('fileName').value = this.value" />
			</div>
		</div>
		</p>

		<p>


		<h6 class="t_float" style="clear: left">Loại Phòng:</h6>

		<?php if($type != ""){?>
		<div class="images">
			<select name="room_type">
				<?php
				foreach ($type as $data)
				{
					?>
				<option value="<?php echo $data['type_id']?>">
					<?php echo $data['type_name']?>
				</option>
				<?php
				}
				?>
			</select>
		</div>
		<?php } else {?>
		<div class="images" style="padding-top: 15px;">
			<a style="margin-top: 10px; font-weight: bold"
				href="<?php echo base_url()?>admin/news_type/index/<?php echo $ur ?>">Vui
				lòng click vào đây để thêm loại phòng trước khi thêm tin</a>
		</div>
		<?php }?>

		<br />
		<h6>Mã tin:</h6>
		<?php
		echo '<div class="inner">';
		$code = "code";
		$label ="Mã tin".' <font color="red" style="font-weight:bold">(*)</font>';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code);
		echo '<div  class="t_float2">',($label),'</div>';
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

		else
	  echo form_input($data, set_value($code));


		echo '</div>';
		?>
		<br />
		<h6>
			<?php echo $this->lang->line('news_title'); ?>
		</h6>

		<?php

		//title  vi


		echo '<div class="inner">';
		$code = "title_vi";
		$label ="Vietnamese".' <font color="red" style="font-weight:bold">(*)</font>';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code);
		echo '<div  class="t_float2">',($label),'</div>';
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

		else
	  echo form_input($data, set_value($code));


		echo '</div>';

		if($num_lang > 1)
		{
			//title en

			echo '<div class="inner">';
			$code = "title_en";
			$label ="English".' <font color="red" style="font-weight:bold">(*)</font>';


			echo '<div  class="t_float2">',($label),'</div>';

			$data = array('name' =>$code,'class'=>'large_input corners');

			if (! empty($missing) && array_key_exists($code, $missing))

				echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

			else
				echo form_input($data, set_value($code));

			echo '</div>';
		}
		?>

		<br />
		<input type="hidden" id="base_url" value="<?php echo base_url()?>" />
		<script src="<?php echo base_url()?>public/js/ajax_one_money_gold.js" type="text/javascript"></script>
		<h6 style="width: 35px;">Giá:</h6>
		<h8 style="width:80px; margin-left:135px; font-size:16px;">
			<b style="color: red;">Vàng nhẫn SJC 99,99 (1 Lượng) = </b>
			<b style="color: red;" id="sjcGold"></b>
			<b style="color: red;"> VNĐ</b>&nbsp;&nbsp;--&nbsp;
			<b style="color: red;">1 USD = </b>
			<b style="color: red;" id="usdPrice"></b>
			<b style="color: red;"> VNĐ</b> </h8>

		<?php

		echo '<div class="inner">';
		$code = "price_usd";
		$label ="USD".' <font color="red" style="font-weight:bold">(*)</font>';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code);
		echo '<div  class="t_float2">',($label),'</div>';
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

		else
	  echo form_input($data, set_value($code));
		echo '</div>';

		echo '<div class="inner">';
		$code = "price_sjc";
		$label ="SJC".' <font color="red" style="font-weight:bold">(*)</font>';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code);
		echo '<div  class="t_float2">',($label),'</div>';
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

		else
	  echo form_input($data, set_value($code));
		echo '</div>';

		echo '<div class="inner">';
		$code = "price_vnd";
		$label ="VNĐ".' <font color="red" style="font-weight:bold">(*)</font>';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code);
		echo '<div  class="t_float2">',($label),'</div>';
		if (! empty($missing) && array_key_exists($code, $missing))

		 echo form_input($data, set_value($code)),'<span class="info_error">error</span>';

		else
	  echo form_input($data, set_value($code));
		echo '</div>';

		?>
		<div class="inner">
			<div class="t_float2">Loại giá:</div>
			<select name="news_pricetype">
				<option value="0">m2</option>
				<option value="1">Theo tháng</option>
			</select>
		</div>
		<br />
		<h6>Các tính nắng dùng tim kiếm tin:</h6>
		<div class="inner">
			<div class="t_float2">Nhu cầu:</div>
			<select name="news_need" class="large_input corners">
				<option value="0">Cần bán</option>
				<option value="1">Cho thuê</option>
			</select>
		</div>

		<div class="inner">
			<div class="t_float2">Loại BDS:</div>
			<select name="news_type" class="large_input corners">
				<option value="0">Căn hộ thường</option>
				<option value="1">Penthouse</option>
				<option value="2">Duplex</option>
				<option value="3">Villa</option>
			</select>
		</div>

		<div class="inner">
			<div class="t_float2">Nội thất:</div>
			<select name="news_furniture" class="large_input corners">
				<option value="0">Nhà trống</option>
				<option value="1">Nội thất cơ bản</option>
				<option value="2">Nội thất đầy đủ</option>
				<option value="3">Nội thất cao cấp</option>
			</select>
		</div>
		<div class="inner">
			<div class="t_float2">Số phòng ngủ:</div>
			<input type="text" name="num_room" class="large_input corners" />
		</div>
		<div class="inner">
			<div class="t_float2">số lầu:</div>
			<input type="text" name="num_floor" class="large_input corners" />
		</div>
		<div class="inner">
			<div class="t_float2">Diện tích</div>
			<input type="text" name="news_area" class="large_input corners" />
		</div>

		</p>


		<h6 class="t_float">Trạng thái</h6>

		<div class="float radio">
			<input type="radio" name="status" id="status" value="1"
				checked="checked" />Hiện <input type="radio" name="status"
				id="status" value="0 " /> ẩn
		</div>

		<p>


		<h6 class="t_float" style="width: 200px;">Giới thiệu ngắn</h6>
		<?php

		$code = "short";
		$label ="Vietnamese";
		echo '<div class="t_float2"> '.$label.'</div>';
		$data = array('name' =>$code,'id' => $code,'class'=>'large_input corners','value' =>'',"style"=>"width:95% !important;height:200px !important");
		echo form_textarea($data);
		?>
		<?php
		$code = "short_en";
		$label ="English";
		echo '<div class="t_float2"> '.$label.'</div>';
		$data = array('name' =>$code,'id' => $code,'class'=>'large_input corners','value' =>'',"style"=>"width:95% !important;height:200px !important");
		echo form_textarea($data);
		?>
		<br />
		<h6>Chi tiết</h6>
		<?php

		//direction vietname
		$code = "direction_vi";
		$label ="Vietnamese";
		echo '<p>';
		echo '<div class="t_float2"> '.$label.'</div>';
		echo '<div class="float">';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' =>  '');
		echo '<div class="textarea"> '.form_textarea($data).'</div>';
		echo '</div>';
		echo '</p>';

		?>
		<br />
		<?php

		//direction vietname
		$code = "direction_en";
		$label ="English";
		echo '<p>';
		echo '<div class="t_float2"> '.$label.'</div>';
		echo '<div class="float">';
		$data = array('name' =>$code,'class'=>'large_input corners' ,'id' => $code, 'value' =>  '');
		echo '<div class="textarea"> '.form_textarea($data).'</div>';
		echo '</div>';
		echo '</p>';

		?>
		</p>

		<?php




		echo form_close(); //FORM END



		?>
	</div>
</div>


<script type="text/javascript">

// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
	document.write(
		'<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
		'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
		'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
		'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
		'value (line 32).' ) ;
}
else
{

	var editor =		CKEDITOR.replace("direction_vi");
	<?php   echo 'var editor2 = CKEDITOR.replace("direction_en");'?>

	//editor.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor2.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor3.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	// Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
	// The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
	CKFinder.setupCKEditor( editor,'<?php echo base_url(); ?>public/scripts/admin/ckfinder') ;  //'../../../../../public/scripts/admin/ckfinder') ;
<?php   echo "CKFinder.setupCKEditor( editor, '".base_url()."public/scripts/admin/ckfinder') ;"?>
	// It is also possible to pass an object with selected CKFinder properties as a second argument.
	// CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}

		</script>
